package thread;

import java.util.concurrent.Callable;
import java.util.concurrent.FutureTask;

/**
 * @author liweimin
 * @date 2021/1/22 17:12
 * @description
 * @since
 */
public class CallableDemo {
    public static class MyCallable implements Callable<String>{

        @Override
        public String call() throws Exception {
            System.out.println("callable接口实现多线程");
            return "Hello World";
        }
    }

    public static void main(String[] args) {
        MyCallable callable = new MyCallable();
        new Thread(new FutureTask<>(callable)).start();
    }
}
